package com.hdf.etdemo.viewframe;

import java.util.ArrayList;
import java.util.List;

import com.hdf.easytools.base.EasyToolsActivity;
import com.hdf.easytools.view.stepview.StepsView;
import com.hdf.etdemo.Adapter;
import com.hdf.etdemo.R;
import com.hdf.etdemo.R.array;
import com.hdf.etdemo.R.drawable;
import com.hdf.etdemo.R.id;
import com.hdf.etdemo.R.layout;
import com.hdf.etdemo.uitl.DemoUtil;
import com.hdf.etdemo.view.gridview.HeadGridViewActivity;
import com.hdf.etdemo.view.listview.ViewPageListViewActivity;
import com.hdf.etdemo.view.stepview.StepViewActivity;
import com.hdf.etdemo.view.text.TextViewActivity;

import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;

import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.Toast;
import android.widget.AdapterView.OnItemClickListener;

public class ViewFrameActivity extends EasyToolsActivity {
	/** 资源对象 */
	public Resources res;
	private ListView mainLv;
	private Context context = ViewFrameActivity.this;
	private Adapter adapter;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_view_frame);
		/** 设置标题显示 */
		this.TitleVisib(0, 1, 1, 0, 0);
		/** 绑定标题点击事件 */
		this.TitleClick(0, 1, 0, 0, 0);
		/** 设置标题样式ʽ */
		res = this.getResources();
		this.TitleStyle(null, R.drawable.et_back, "常用布局框架", null, 0);
		String str[] = res.getStringArray(R.array.viewdata);
		List<String> data = new ArrayList<String>();
		for (int i = 0; i < str.length; i++) {
			data.add(str[i]);
		}
		adapter = new Adapter(context);
		adapter.setAppList(data);
		mainLv = (ListView) findViewById(R.id.listviewlv);
		mainLv.setAdapter(adapter);
		mainLv.setOnItemClickListener(new OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
				// TODO Auto-generated method stub
				intent(arg2);
			}
		});
	}

	private Intent intent;

	private void intent(int item) {
		if (item == 0) 
			GoActivity(SlidingtabActivity.class);
		if (item == 1)
			GoActivity(HomeFragmentActivity.class);
		if (item == 2)
			GoActivity(ViewPageFragmentActivity.class);
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch (v.getId()) {
		case R.id.left_img:
			finish();
			break;

		default:
			break;
		}
	}
}
